﻿using QDPay.Bus.domain.json;
using QDPay.Bus.util;
using System;
using System.Collections.Generic;
using System.Text;

namespace QDPay.Bus
{
    public class Orders : BusinessBase
    {
        /// <summary>
        /// 创建订单
        /// </summary>
        /// <param name="uid">付款用户id</param>
        /// <param name="createUid">商家id</param>
        /// <param name="orderAmount">付款金额(单位：元)</param>
        /// <param name="employeeId">登录的员工Id</param>
        /// <returns></returns>
        public int CreateOrder(int uid, int createUid, decimal orderAmount,int employeeId)
        {
            var url = string.Format("{0}/api/order/SubmitDirectPaymentOrder?storeid=68&uid={1}&Cashier={2}&OrderAmount={3}&employeeId={4}", ApiConfig.Domain, uid, createUid, orderAmount, employeeId);
            var json = RestHttp.Get<JsonBase<string>>(url);
            if (IsSuccess(json))
                return Convert.ToInt32(json.Data);
            return 0;
        }
    }
}
